package cn.vcjf.weapp.api.payment.qfwxpay.model;

import cn.vcjf.weapp.common.util.DateUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * @Auther: zhengzihang
 * @Date: 2018/9/28 11:47
 * @Description:
 */
public class VcQfPayReq {

	public String txamt;		//Y订单支付金额，单位分。
	public String txcurrcd;		//Y币种港币：HKD ；人民币：CNY。
	public String payType;		//Y支付类型微信公众号支付:800207。
	public String outTradeNo;	//Y外部订单号，开发者平台订单号
	public String txdtm;		//Y请求交易时间 格式为：yyyy-MM-dd HH:mm:ss
	public String subOpenid;	//Y微信的openid
	public String goodsName;	//Y商品名称标示
	public String mchid;		//Y子商户号，标识子商户身份
	public String limitay;	//否	    //N该参数值指定为no_credit，则禁止使用信用卡支付
	public String udid;		//否		//N设备唯一id
	private String syssn;
	private String merchName;

	public static VcQfPayReq getPayEntity(){
		VcQfPayReq entity = new VcQfPayReq();
		entity.setTxamt("1");
		entity.setTxcurrcd("CNY");
		entity.setPayType("800207");
		entity.setOutTradeNo("201710162033283596");
		entity.setTxdtm("2018-01-24 15:26:25");
		entity.setSubOpenid("oo3Lss8tu7HhdefS02-t9Ro341zc");
		entity.setGoodsName("测试");
		//entity.setMchid(QtGetWechatCodeAndOpenid.merchId);
		return entity;
	}

	public String getTxamt() {
		return txamt;
	}
	public void setTxamt(String txamt) {
		this.txamt = txamt;
	}
	public String getTxcurrcd() {
		if(StringUtils.isBlank(txcurrcd)){
			txcurrcd = "CNY";
		}
		return txcurrcd;
	}
	public void setTxcurrcd(String txcurrcd) {
		this.txcurrcd = txcurrcd;
	}
	public String getPayType() {
		if(StringUtils.isBlank(payType)){
			payType = "800207";
		}
		return payType;
	}

	public static String PAY_TYPE_WXSCAN = "800201";
	public static String PAY_TYPE_WXGZH = "800207";
	/*  支付类型
        支付宝扫码:800101；支付宝反扫:800108； 支付宝服务窗：800107；
        微信扫码:800201；微信刷卡:800208； 微信公众号:800207；*/
	public void setPayType(String payType) {
		this.payType = payType;
	}
	public String getOutTradeNo() {
		return outTradeNo;
	}
	public void setOutTradeNo(String outTradeNo) {
		this.outTradeNo = outTradeNo;
	}
	public String getTxdtm() {
		if(StringUtils.isBlank(txdtm)){
			txdtm = DateUtils.getDate("yyyy-MM-dd HH:mm:ss");
		}
		return txdtm;
	}
	public void setTxdtm(String txdtm) {
		this.txdtm = txdtm;
	}
	public String getSubOpenid() {
		return subOpenid;
	}
	public void setSubOpenid(String subOpenid) {
		this.subOpenid = subOpenid;
	}
	public String getGoodsName() {
		return goodsName;
	}
	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}
	public String getMchid() {
		return mchid;
	}
	public void setMchid(String mchid) {
		this.mchid = mchid;
	}
	public String getLimitay() {
		return limitay;
	}
	public void setLimitay(String limitay) {
		this.limitay = limitay;
	}
	public String getUdid() {
		return udid;
	}
	public void setUdid(String udid) {
		this.udid = udid;
	}

	public static VcQfPayRes checkQtPayReq(VcQfPayReq req) {
		if(StringUtils.isBlank(req.getMchid())){
			return VcQfPayRes.failedPayResp("商户交易号不存在.");
		}
		return VcQfPayRes.successPayRes("成功");
	}

	public String getSyssn() {
		return syssn;
	}

	public void setSyssn(String syssn) {
		this.syssn = syssn;
	}

	public String getMerchName() {
		return merchName;
	}

	public void setMerchName(String merchName) {
		this.merchName = merchName;
	}
}
